var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", { value: !0 });
var n = t("Const"),
    r = t("locales"),
    a = t("Recorder"),
    i = t("Fangchenmis"),
    s = t("LoadImgs"),
    c = t("LoadingInfos"),
    l = t("md5"),
    u = t("Platforms"),
    p = t("Sounds"),
    f = t("OpenDataContexts"),
    d = require("./假广告用来苹果过审"),
    h = t("VideoAdCtrlN"),
    y = require("../../scripts/加载子包"),
    g = t("AddToFavorite"),
    v = t("LingquJiangli"),
    m = t("TA"),
    _ = t("DD"),
    A = t("BootConst"),
    b = t("WX"),
    C = t("TableRules"),
    w = t("Scores"),
    O = t("ConfS"),
    P = (function() {
        function t() {
            var t = this;
            if (
                ((this.languageKeys = ["CN", "TW", "EN"]),
                    (this._onShow = function(e) {
                        console.log("_onShow " + JSON.stringify(e)),
                            u.default.delays.clear("延时处理onShow"),
                            u.default.delays.delay({
                                time: 0.5,
                                action: function() {
                                    if ((p.Sounds.resumeMusic(), t.onShareCallback))
                                        O.DatasManager.a ?
                                        t.shareSuccess() :
                                        (o = new Date().getTime() - t.startShareTime) >
                                        1e3 * O.DatasManager.分享必须N秒以上 &&
                                        100 * Math.random() < O.DatasManager.分享成功概率 ?
                                        t.shareSuccess() :
                                        t.shareFailed(
                                            r.locales.getText([
                                                O.DatasManager.分享失败提示CN,
                                                O.DatasManager.分享失败提示CN,
                                                O.DatasManager.分享失败提示EN
                                            ])
                                        );
                                    else if (t.onHutuiCallback) {
                                        var o = new Date().getTime() - t.hutuiStartTime;
                                        t.onHutuiCallback(o > 15e3), (t.onHutuiCallback = null);
                                    } else
                                        t.从分享回来 ||
                                        (e.query && e.query.shareMessageToFriendScene) ||
                                        (O.DatasManager.离开游戏后返回弹出瀑布流 && u.default.显示瀑布());
                                    (t.从分享回来 = !1), t.addLaunchOption(e);
                                    for (var n = 0, a = t.onShows; n < a.length; n++) {
                                        (0, a[n])();
                                    }
                                },
                                group: "延时处理onShow"
                            });
                    }),
                    (this._onHide = function(e) {
                        p.Sounds.pauseMusic();
                        for (var o = 0, n = t.onHides; o < n.length; o++) {
                            (0, n[o])();
                        }
                    }),
                    (this.oks = new Array()),
                    this.获取物理参数(),
                    this.screenWidth > 0 && this.screenHeight > 0)
            );
            else {
                var e = cc.view.getVisibleSizeInPixel();
                (this.screenWidth = e.width), (this.screenHeight = e.height);
            }
            (this.肥屏 = !1),
            n.default.wid0 > n.default.hei0 ?
                ((this.肥屏 = this.screenWidth / this.screenHeight < n.default.wid0 / n.default.hei0),
                    this.肥屏 ?
                    ((this.物理屏幕和画布的比例 = this.screenWidth / n.default.wid0),
                        (cc.Canvas.instance.fitHeight = !1),
                        (cc.Canvas.instance.fitWidth = !0)) :
                    (this.物理屏幕和画布的比例 = this.screenHeight / n.default.hei0)) :
                ((this.肥屏 = this.screenHeight / this.screenWidth < n.default.hei0 / n.default.wid0),
                    this.肥屏 ?
                    ((this.物理屏幕和画布的比例 = this.screenHeight / n.default.hei0),
                        (cc.Canvas.instance.fitWidth = !1),
                        (cc.Canvas.instance.fitHeight = !0)) :
                    (this.物理屏幕和画布的比例 = this.screenWidth / n.default.wid0)),
                (n.default.stageWid = cc.winSize.width),
                (n.default.stageHei = cc.winSize.height),
                n.default.wid0 > n.default.hei0 ?
                ((n.default.swid = Math.min(n.default.maxWid, n.default.stageWid)),
                    (n.default.shei = n.default.hei0),
                    (u.default.横向安全边距 = (n.default.stageWid - n.default.swid) / 2),
                    (u.default.纵向安全边距 = 0)) :
                ((n.default.swid = n.default.wid0),
                    (n.default.shei = Math.min(n.default.maxHei, n.default.stageHei)),
                    (u.default.横向安全边距 = 0),
                    (u.default.纵向安全边距 = (n.default.stageHei - n.default.shei) / 2)),
                (this.lastSetStoreTime = 0),
                (this.launchScene = 12345),
                (this.launchQuery = null),
                (this.launchOptions = new Array()),
                (this.onShows = new Array()),
                (this.onHides = new Array()),
                this.getSettings();
        }
        return (
            (t.prototype.getCPAConfigURL12 = function(t) {
                var e = "61b59ba885d90188169f17dbacd29d74",
                    o = new Date().getTime(),
                    n = "0ceaf4f01e84e726c6603b9f9575a7d5",
                    r =
                    "?apisign=" +
                    l.md5(e + o + n) +
                    "&apikey=" +
                    e +
                    "&timestamp=" +
                    o +
                    "&apiSecret=" +
                    n +
                    "&appkey=" +
                    t;
                (this.gogogo = "" + r), (this.gogogo = "" + r), (this.cpaConfigURL2 = this.cpaConfigURL1);
            }),
            (t.prototype._init = function(t) {
                var e = this;
                if (((this.onInitComplete = t), u.default.userStorage.selectedLanguageKey))
                    this.languageKey = u.default.userStorage.selectedLanguageKey;
                else {
                    var o = this.language.toLowerCase();
                    this.languageKey = null;
                    for (var r = 0, a = this.languageKeys; r < a.length; r++) {
                        var i = a[r],
                            s = O.DatasManager[i];
                        if (s) {
                            for (var l = 0, p = s; l < p.length; l++) {
                                var f = p[l];
                                if (new RegExp(f).test(o)) {
                                    this.languageKey = i;
                                    break;
                                }
                            }
                            if (this.languageKey) break;
                        }
                    }
                    this.languageKey || (this.languageKey = this.defaultLanguageKey);
                }
                var d = function(t) {
                    m.default.login(u.default.userStorage.openId),
                        t &&
                        e.dd(A.dd.register, {
                            type: u.default.platformType,
                            eventTime: Date.now(),
                            scene: e.launchScene,
                            openId: u.default.userStorage.openId,
                            a: _.default.A
                        }),
                        e.dd(A.dd.login, { version: n.default.version, eventTime: Date.now() });
                };
                u.default.userStorage.openId ?
                    (this.ok("noLogin"), d(!1)) :
                    (c.default.start("登录"),
                        this.login(function() {
                            c.default.end("登录"), e.ok("login"), d(!0);
                        }));
                var h = u.default.getBundleNames(this.subpackageNames, !1);
                h
                    ?
                    this.loadSubpackages(h, function() {
                        e.ok("loadSubpackages");
                    }) :
                    this.ok("noSubpackages"),
                    this.检查是否过滤显示广告() && this.初始化时初始化广告();
            }),
            (t.prototype.loadSubpackages = function(t, e) {
                for (
                    var o = t.length,
                        n = function(t) {
                            c.default.start("加载子包" + t),
                                y.default.load(t, function() {
                                    c.default.end("加载子包" + t), --o <= 0 && e();
                                });
                        },
                        r = 0,
                        a = t; r < a.length; r++
                ) {
                    n(a[r]);
                }
            }),
            (t.prototype.ok = function(t) {
                this.oks.push(t);
                this.oks.length >= 3 && (this.onInitComplete(), (this.onInitComplete = null));
            }),
            (t.prototype.login = function(t) {
                t && t();
            }),
            (t.prototype.checkLogin = function(t) {
                t && t(!!u.default.userStorage.openId);
            }),
            (t.prototype.各种东西都加载完了 = function() {
                this.检查是否过滤显示广告() && this.初始化完毕初始化广告();
            }),
            (t.prototype.addLaunchOption = function(t) {
                this.launchOptions.push(t), this.checkLaunchOptions();
            }),
            (t.prototype.checkLaunchOptions = function() {
                if (this.已进入游戏) {
                    for (var t = 0, e = this.launchOptions; t < e.length; t++) {
                        var o = e[t];
                        if (
                            (console.log("launchOption=" + JSON.stringify(o)),
                                o.query &&
                                (o.query.record && (this.record = o.query.record),
                                    o.query.openId && this.我是从邀请点进来的(o.query.openId),
                                    o.query.fubenId && (this.被邀请打本 = o),
                                    o.query.roomInfo && (this.被邀请进房间 = o),
                                    o.query.shareMessageToFriendScene))
                        ) {
                            var n = parseInt(o.query.shareMessageToFriendScene);
                            switch ((console.log("shareMessageToFriendScene=" + n), n)) {
                                case f.ShareMessageToFriendScene.送钻石:
                                    this.好友送的钻石 = o;
                            }
                        }
                        if (u.default.platformCtrl.显示收藏有礼 && "已提示收藏" == u.default.userStorage.收藏) {
                            var r = !1;
                            switch (u.default.platformType) {
                                case "微信小游戏":
                                    switch (o.scene) {
                                        case 1001:
                                        case 1089:
                                        case 1103:
                                        case 1104:
                                            r = !0;
                                    }
                                    break;
                                case "QQ小程序":
                                case "红包QQ":
                                    switch (o.scene) {
                                        case 3003:
                                            r = !0;
                                    }
                            }
                            r &&
                                (console.log("阅读收藏有礼并从我的小程序进入 " + o.scene), (this.添加到我的小程序 = o));
                        }
                    }
                    (this.launchOptions.length = 0),
                    this.处理被邀请进房间() || (u.default.当前在主界面 && this.在主界面处理的LaunchOption());
                }
            }),
            (t.prototype.我是从邀请点进来的 = function(t) {
                if (u.default.userStorage.openId) {
                    if (u.default.userStorage.openId == t) return;
                    console.log("我是从邀请点进来的 邀请者的openId=" + t),
                        u.default.userStorage.被邀请openIds.includes(t) ||
                        (u.default.userStorage.被邀请openIds.length < O.DatasManager.每天被邀请次数上限 ?
                            ((this.邀请者的openId = t),
                                console.log("被 " + t + " 邀请成功，可以去做指定的任务让该好友获取对应奖励。"),
                                u.default.userStorage.被邀请openIds.push(this.邀请者的openId),
                                u.default.userStorage.setDirty()) :
                            console.error(
                                "已达到每天被邀请次数上限：" + O.DatasManager.每天被邀请次数上限 + "！"
                            ));
                }
            }),
            (t.prototype.满足被邀请条件 = function() {
                this.邀请者的openId &&
                    (u.default.userStorage.已经满足条件的被邀请openIds.includes(this.邀请者的openId) ||
                        (console.log("对好友 " + this.邀请者的openId + " 发放对应奖励。"),
                            u.default.userStorage.已经满足条件的被邀请openIds.push(this.邀请者的openId),
                            u.default.userStorage.setDirty(),
                            this.invite(this.邀请者的openId)));
            }),
            (t.prototype.在主界面处理的LaunchOption = function() {
                return this.领取好友送的钻石() || this.领取收藏有礼奖励() || this.处理被邀请打本();
            }),
            (t.prototype.领取好友送的钻石 = function() {
                return (!!this.好友送的钻石 &&
                    (console.log("领取好友送的钻石", this.好友送的钻石),
                        f.default.modifyFriendInteractiveStorage(f.ShareMessageToFriendScene.送钻石),
                        (this.好友送的钻石 = null), !0)
                );
            }),
            (t.prototype.领取收藏有礼奖励 = function() {
                return (!!this.添加到我的小程序 &&
                    (console.log("领取收藏有礼奖励", this.添加到我的小程序),
                        u.default.popups.getPopup(g.AddToFavorite).hide(),
                        u.default.popups
                        .show(v.LingquJiangli)
                        .set(
                            O.DatasManager.客服签到领奖励货币,
                            O.DatasManager.客服签到领奖励货币数量,
                            0,
                            "“添加到我的小程序”奖励！"
                        ),
                        (u.default.userStorage.收藏 = "已领取奖励"),
                        u.default.userStorage.setDirty(),
                        (this.添加到我的小程序 = null),
                        n.default.隐藏收藏有礼按钮(),
                        this.addToFavorites(), !0)
                );
            }),
            (t.prototype.处理被邀请打本 = function() {
                return (!!this.被邀请打本 &&
                    (console.log("处理被邀请打本", this.被邀请打本),
                        this.onInviteFuben &&
                        this.onInviteFuben(this.被邀请打本.query.openId, this.被邀请打本.query.fubenId),
                        (this.被邀请打本 = null), !0)
                );
            }),
            Object.defineProperty(t.prototype, "onInviteJoinRoom", {
                set: function(t) {
                    (this._onInviteJoinRoom = t),
                    console.log("set onInviteJoinRoom", this._onInviteJoinRoom ? "_onInviteJoinRoom" : "null"),
                        this._onInviteJoinRoom && this.处理被邀请进房间();
                },
                enumerable: !1,
                configurable: !0
            }),
            (t.prototype.处理被邀请进房间 = function() {
                return (!!this.被邀请进房间 &&
                    (console.log(
                            "处理被邀请进房间",
                            this.被邀请进房间,
                            this._onInviteJoinRoom ? "_onInviteJoinRoom" : "null"
                        ),
                        this._onInviteJoinRoom &&
                        this._onInviteJoinRoom(
                            this.被邀请进房间.query.openId,
                            JSON.parse(
                                pako.ungzip(
                                    u.default.base64Decode(this.被邀请进房间.query.roomInfo.replace(/ /g, "+")), { to: "string" }
                                )
                            )
                        ),
                        (this.被邀请进房间 = null), !0)
                );
            }),
            (t.prototype.添到桌面成功 = function() {
                u.default.popups
                    .show(v.LingquJiangli)
                    .set(
                        O.DatasManager.客服签到领奖励货币,
                        O.DatasManager.客服签到领奖励货币数量,
                        0,
                        "“添加到桌面”奖励！"
                    ),
                    (u.default.userStorage.已添到桌面 = !0),
                    u.default.userStorage.setDirty(),
                    n.default.隐藏添到桌面按钮();
            }),
            (t.prototype.loadCPA12 = function(t) {
                var e = this;
                c.default.start("加载CPA"),
                    this.get({ url: u.default.userStorage.误触黑 ? this.cpaConfigURL1 : this.cpaConfigURL2 }, !1,
                        function(o) {
                            if (o && o.data && o.data.length) {
                                for (
                                    var n = {
                                            开: !0,
                                            加载页显示: !0,
                                            黑名单: [],
                                            苹果不显示: [],
                                            推荐1: [],
                                            推荐2: [],
                                            atlas: null,
                                            文字底: null,
                                            cpbs: []
                                        },
                                        r = -1,
                                        a = 0,
                                        i = o.data; a < i.length; a++
                                ) {
                                    var s = i[a];
                                    r++,
                                    s.Position <= 4 ? n.推荐1.push(r) : n.推荐2.push(r),
                                        n.cpbs.push({
                                            appId: s.GameAppId,
                                            name: s.GameName,
                                            nameRect: null,
                                            path: s.PromoteLink,
                                            icon: s.Icon,
                                            iconRect: null,
                                            insert: ""
                                        });
                                }
                                e.getCPB(n, null);
                            } else e.getCPB(null, null);
                            c.default.end("加载CPA"), t && t();
                        },
                        t
                    );
            }),
            (t.prototype.loadCPB = function(t) {
                var e = this;
                c.default.start("加载CPA"),
                    this.get({ url: this.cpbConfigURL }, !0, function(o) {
                        e.getCPB(o, t), c.default.end("加载CPA");
                    });
            }),
            (t.prototype.getCPB = function(t, e) {
                var o = this;
                if (t && t.开 && t.cpbs) {
                    t.推荐1 || (t.推荐1 = new Array()), t.推荐2 || (t.推荐2 = new Array());
                    for (var r = t.cpbs.length; r--;) t.cpbs[r].appId == e && (t.cpbs[r] = null);
                    if (cc.sys.os == cc.sys.OS_IOS && t.苹果不显示)
                        for (var a = 0, i = t.苹果不显示; a < i.length; a++) {
                            var c = i[a];
                            t.cpbs[c] = null;
                        }
                    for (r = t.cpbs.length; r--;)
                        if (t.cpbs[r]);
                        else {
                            t.cpbs.splice(r, 1);
                            for (var l = t.推荐1.length; l--;)
                                t.推荐1[l] == r ? t.推荐1.splice(l, 1) : t.推荐1[l] > r && t.推荐1[l]--;
                            for (l = t.推荐2.length; l--;)
                                t.推荐2[l] == r ? t.推荐2.splice(l, 1) : t.推荐2[l] > r && t.推荐2[l]--;
                        }
                    if (!(t.cpbs.length > 0)) return;
                    for (
                        u.default.disorder(t.推荐1), u.default.disorder(t.推荐2); t.推荐1.length < 4 && t.推荐2.length;

                    )
                        t.推荐1.push(t.推荐2.pop());
                    if (t.推荐1.length < 4)
                        for (
                            r = t.cpbs.length; r-- && (-1 != t.推荐1.indexOf(r) || (t.推荐1.push(r), t.推荐1.length < 4));

                        );
                    (r = -1), (t.全部 = new Array()), (t.除推荐1 = new Array());
                    for (var p = 0, f = t.cpbs; p < f.length; p++) {
                        f[p];
                        r++, t.全部.push(r), -1 == t.推荐1.indexOf(r) && t.除推荐1.push(r);
                    }
                    u.default.disorder(t.全部),
                        u.default.disorder(t.除推荐1),
                        t.atlas ?
                        s.LoadImgs.load(n.default.url_prefix_cpb + t.atlas, !0, function(e) {
                            (o.cpbConfig = t), (o.cpbAtlas = e.getTexture()), u.default.getCPBComplete();
                        }) :
                        ((this.cpbConfig = t), (this.cpbAtlas = null), u.default.getCPBComplete());
                }
            }),
            (t.prototype.rating = function() {}),
            (t.prototype.exit = function() {}),
            (t.prototype.pay = function(t, e) {
                e && e(!0);
            }),
            (t.prototype.getSettings = function() {
                var t = this;
                c.default.start("获取线上配置");
                var e = function(e) {
                    if (
                        (c.default.end("获取线上配置"),
                            console.log("本地配置版本 " + O.DatasManager.系统配置版本 + ", 线上配置版本 " + e.系统配置版本),
                            e.系统配置版本 > O.DatasManager.系统配置版本)
                    ) {
                        for (var o in e) O.DatasManager[o] = e[o];
                        console.log("使用线上配置");
                    } else console.log("使用本地配置");
                    u.default.类原生和原生() || ((O.DatasManager.失败显示CPA = !0), (O.DatasManager.失败展示瀑布 = !0)),
                        t.显示红包 || (O.DatasManager.红包 = !1),
                        C.TableRules.show(u.default.container, "加载线上配置完毕"),
                        t.ok("getSettings");
                };
                this.get({ url: n.default.url_prefix_web + "settings.json" }, !0, e, function() {
                    e({ 系统配置版本: "0" });
                });
            }),
            (t.prototype.getInviteList = function(t) {
                this.post({ op: "getInviteList", openId: u.default.userStorage.openId }, function(e) {
                    (e.openIds && e.openIds.indexOf && e.openIds.push) || (e.openIds = new Array()), t(e);
                });
            }),
            (t.prototype.invite = function(t) {
                this.post({ op: "invite", openId: u.default.userStorage.openId, friendOpenId: t }, null);
            }),
            (t.prototype.getGift = function(t, e, o) {
                this.post({
                        op: "getGift",
                        openId: u.default.userStorage.openId,
                        nickname: u.default.userStorage.nickname,
                        code: t
                    },
                    e,
                    o, !0
                );
            }),
            (t.prototype.activate = function(t, e) {
                this.post_api({ gogogo: "", proj: n.default.gameName, openid: u.default.userStorage.openId, code: t }, e);
            }),
            (t.prototype.getVS = function(t, e) {
                this.post({ op: "getVS", openId: u.default.userStorage.openId, vss: t.toString() }, e);
            }),
            (t.prototype.vsWin = function(t, e, o) {
                this.post({ op: "vsWin", openId: u.default.userStorage.openId, vsOpenId: t, vss: e.toString() }, o);
            }),
            (t.prototype.vsWin2 = function(t, e) {
                this.post({ op: "vsWin2", openId: u.default.userStorage.openId, vsOpenId: t, vsScore: e }, null);
            }),
            (t.prototype.getYuanzheng = function(t, e) {
                this.post({ op: "getYuanzheng", openId: u.default.userStorage.openId, powerRanges: t.toString() }, e);
            }),
            (t.prototype.setPowers = function(t) {
                this.post({ op: "setPowers", openId: u.default.userStorage.openId, powers: t }, null);
            }),
            (t.prototype.gameRecorder_init = function() {
                return !1;
            }),
            (t.prototype.gameRecorder_start = function() {}),
            (t.prototype.gameRecorder_stop = function() {}),
            (t.prototype.gameRecorder_share = function() {}),
            (t.prototype.showGameRecorderShareButton = function(t) {}),
            (t.prototype.hideGameRecorderShareButton = function() {}),
            (t.prototype.showAppBox = function() {}),
            (t.prototype.saveAppToDesktop = function() {}),
            (t.prototype.addToFavorites = function() {}),
            (t.prototype.获取今天的红包配置信息 = function(t) {}),
            (t.prototype.领取红包 = function(t) {
                t && t("");
            }),
            (t.prototype.showMoreGamesModal = function() {}),
            (t.prototype.获取n个重复随机CPB = function(t) {
                if (this.cpbConfig) {
                    for (var e = new Array(), o = -1, n = 0, r = this.cpbConfig.cpbs; n < r.length; n++) {
                        var a = r[n];
                        o++,
                        (u.default.userStorage.用户当天跳转过的CPA图标 &&
                            u.default.userStorage.用户当天跳转过的CPA图标.indexOf(a.appId) > -1) ||
                        e.push(o);
                    }
                    if (e.length > 0) {
                        for (var i = new Array(); i.length < t;) u.default.disorder(e), (i = i.concat(e));
                        return (i.length = t), i;
                    }
                }
                return null;
            }),
            (t.prototype.openCPB = function(t, e, o, r, a, i, s) {
                var c = this;
                this.dd(A.dd.cpa, {
                        action: "click",
                        index: u.default.platformCtrl.cpbConfig.cpbs.indexOf(e),
                        gameName: e.name,
                        appId: e.appId
                    }),
                    this._openCPB(
                        e,
                        function(a) {
                            c.dd(A.dd.cpa, {
                                    action: "confirm",
                                    index: u.default.platformCtrl.cpbConfig.cpbs.indexOf(e),
                                    gameName: e.name,
                                    appId: e.appId
                                }),
                                s && s(t, e, !0),
                                o &&
                                (u.default.userStorage.用户当天跳转过的CPA图标.push(e.appId),
                                    u.default.userStorage.setDirty(),
                                    u.default.bottomCPBs && u.default.bottomCPBs.refresh(),
                                    u.default.waterfall && u.default.waterfall.refresh()),
                                r &&
                                ((t.node.active = !1),
                                    u.default.delays.delay({
                                        time: 0.5,
                                        action: function() {
                                            n.default.addMoney(
                                                    "金币",
                                                    u.default.CPA打开成功给金币(),
                                                    "CPA成功给金币",
                                                    t.node,
                                                    null
                                                ),
                                                u.default.userStorage.setDirty();
                                        }
                                    }));
                        },
                        function(o) {
                            s && s(t, e, !1),
                                O.DatasManager.失败展示瀑布 &&
                                a &&
                                (u.default.显示瀑布(), i && u.default.随机跳一个CPA());
                        }
                    );
            }),
            (t.prototype._openCPB = function(t, e, o) {}),
            (t.prototype.createFeedbackButton = function(t) {}),
            (t.prototype.destroyFeedbackButton = function() {}),
            (t.prototype.createUserInfoButton = function(t, e) {
                return null;
            }),
            (t.prototype.destroyUserInfoButton = function(t) {}),
            (t.prototype.destroyUserInfoButtons = function() {}),
            (t.prototype.openDayGem = function() {}),
            (t.prototype.canRequestSubscribeMessage = function() {
                return !1;
            }),
            (t.prototype.requestSubscribeMessage = function(t, e) {}),
            (t.prototype.dd_showPage = function(t) {
                if (A.dd.使用微信自定义场景行为) {
                    var e = b.default.getArgs(t, "page");
                    e ? this.dd(e) : this.dd(A.dd.missedPage, { index: b.default.getBranchDimByName(t) });
                }
            }),
            (t.prototype.dd_hidePage = function(t) {}),
            (t.prototype.dd_showBanner = function(t, e) {
                A.dd.banner &&
                    (u.default.userStorage.加玩家总次数("bannerShow"),
                        this.dd(A.dd.banner.bannerShow, {
                            index: b.default.getBranchDimByAdId(e),
                            wx_eventType: 1,
                            eventTime: Date.now(),
                            entry: t,
                            CountNum: u.default.userStorage.获取玩家总次数("bannerShow"),
                            CountNumToday: u.default.userStorage.获取玩家今日总次数("bannerShow")
                        }));
            }),
            (t.prototype.dd_showBannerCallback = function(t, e, o) {
                A.dd.banner &&
                    this.dd(o ? A.dd.banner.bannerShowSuccess : A.dd.banner.bannerShowFailed, {
                        index: b.default.getBranchDimByAdId(e),
                        wx_eventType: 1,
                        eventTime: Date.now(),
                        entry: t,
                        CountNum: u.default.userStorage.获取玩家总次数("bannerShow"),
                        CountNumToday: u.default.userStorage.获取玩家今日总次数("bannerShow")
                    });
            }),
            (t.prototype.dd_showBottomCPBs = function(t) {
                this.dd(A.dd.bottomCPBs);
            }),
            (t.prototype.dd_clickVideoBtn = function(t, e, o) {
                (this.watchVideoStartTime = Date.now()),
                u.default.userStorage.加玩家总次数("rewardShow"),
                    this.dd(t && t.rewardShow, {
                        index: b.default.getBranchDimByAdId(e),
                        wx_eventType: o ? 1 : 2,
                        eventTime: Date.now(),
                        entry: _.default.getName(t),
                        CountNum: u.default.userStorage.获取玩家总次数("rewardShow"),
                        CountNumToday: u.default.userStorage.获取玩家今日总次数("rewardShow")
                    });
            }),
            (t.prototype.dd_closeVideo = function(t, e, o) {
                o
                    ?
                    (u.default.userStorage.加玩家总次数("rewardDone"),
                        this.dd(t.rewardDone, {
                            index: b.default.getBranchDimByAdId(e),
                            wx_eventType: 1,
                            eventTime: Date.now(),
                            entry: _.default.getName(t),
                            CountNum: u.default.userStorage.获取玩家总次数("rewardShow"),
                            CountNumToday: u.default.userStorage.获取玩家今日总次数("rewardShow")
                        })) :
                    this.dd(t.rewardNotDone, {
                        index: b.default.getBranchDimByAdId(e),
                        wx_eventType: 1,
                        eventTime: Date.now(),
                        entry: _.default.getName(t),
                        duration: (Date.now() - this.watchVideoStartTime) / 1e3,
                        CountNum: u.default.userStorage.获取玩家总次数("rewardShow"),
                        CountNumToday: u.default.userStorage.获取玩家今日总次数("rewardShow")
                    });
            }),
            (t.prototype.dd_videoError = function(t, e) {
                this.dd(t.rewardError, { index: b.default.getBranchDimByAdId(e) });
            }),
            (t.prototype.dd = function(t, e) {
                t ? _.default.dd(t, e) : console.error("dd args=" + t + " " + JSON.stringify(e));
            }),
            (t.prototype.initShares = function() {
                u.default.shares = new Array();
                for (
                    var t = 0,
                        e =
                        (O.DatasManager.a || u.default.userStorage.误触黑) &&
                        O.DatasManager.分享们a &&
                        O.DatasManager.分享们a.length ?
                        O.DatasManager.分享们a :
                        O.DatasManager.分享们b; t < e.length; t++
                )
                    for (var o = e[t], n = o.rate; n--;) u.default.shares.push(o);
            }),
            (t.prototype.getShare = function(t) {
                var e,
                    o = this;
                return (
                    (e = t ?
                        "12345" :
                        (t = u.default.shares[Math.floor(Math.random() * u.default.shares.length)]).query.match(
                            /id\=(\d+)/
                        )[1]),
                    (t = JSON.parse(JSON.stringify(t))),
                    u.default.userStorage.nickname ?
                    (n.default.替换有人At你 &&
                        (t.title = t.title.replace("有人@你", u.default.userStorage.nickname + "@你")),
                        (t.title = t.title.replace("{nickname}", u.default.userStorage.nickname))) :
                    (t.title = t.title.replace("{nickname}", "有人")),
                    (t.query = "id=" + e + "&openId=" + u.default.userStorage.openId),
                    (t.success = function() {
                        console.log("分享成功"), o.onShareCallback && o.shareSuccess();
                    }),
                    (t.fail = function(t) {
                        console.error("分享失败" + t),
                            o.onShareCallback &&
                            o.shareFailed(
                                r.locales.getText([
                                    O.DatasManager.分享失败提示CN,
                                    O.DatasManager.分享失败提示CN,
                                    O.DatasManager.分享失败提示EN
                                ])
                            );
                    }),
                    t
                );
            }),
            (t.prototype._share = function(t, e) {
                (this.从分享回来 = !0),
                u.default.userStorage.加玩家总次数("share"),
                    t &&
                    t.share &&
                    this.dd(t.share, {
                        eventTime: Date.now(),
                        entry: _.default.getName(t),
                        CountNum: u.default.userStorage.获取玩家总次数("share"),
                        CountNumToday: u.default.userStorage.获取玩家今日总次数("share")
                    });
            }),
            (t.prototype.share = function(t, e) {
                (this.onShareCallback = e),
                this.onShareCallback && (this.startShareTime = new Date().getTime()),
                    this._share(t, this.getShare());
            }),
            (t.prototype.shareRecord = function(t) {
                this.shareImgURL && (t.imageUrl = this.shareImgURL),
                    (t.query += "&record=" + a.recorder.encode()),
                    this._share(null, t);
            }),
            (t.prototype.shareFuben = function(t, e) {
                ((t = u.default.platformCtrl.getShare(t)).query += "&fubenId=" + e), this._share(A.dd.shareFuben, t);
            }),
            (t.prototype.shareRoomInfo = function(t, e) {
                ((t = u.default.platformCtrl.getShare(t)).query +=
                    "&roomInfo=" + u.default.base64Encode(pako.gzip(JSON.stringify(e), { to: "string" }))),
                this._share(A.dd.shareFuben, t);
            }),
            (t.prototype.shareSuccess = function() {
                this.shareCallback(!0);
            }),
            (t.prototype.shareFailed = function(t) {
                this.toast(t), this.shareCallback(!1);
            }),
            (t.prototype.shareCallback = function(t) {
                if (
                    (t &&
                        (u.default.userStorage.加玩家总次数("shareSuccess"),
                            w.scores.add("分享加分", O.DatasManager.每分享一次得分)),
                        this.onShareCallback)
                ) {
                    var e = this.onShareCallback;
                    (this.onShareCallback = null), e(t);
                }
            }),
            (t.prototype.需要限制游戏 = function(t) {
                var e = this;
                if (
                    (i.Fangchenmis.instance || new i.Fangchenmis(),
                        (this.限制游戏小时数 = t), !i.Fangchenmis.instance.counter2)
                ) {
                    var o = u.default.userStorage.getCurrDate();
                    u.default.userStorage.fangchenmi_date >= o ||
                        ((u.default.userStorage.fangchenmi_date = o),
                            (u.default.userStorage.fangchenmi_startTime = new Date().getTime()),
                            u.default.userStorage.setDirty());
                    var n = Math.round(
                        60 * this.限制游戏小时数 * 60 -
                        (new Date().getTime() - u.default.userStorage.fangchenmi_startTime) / 1e3
                    );
                    n > 0 || (n = 0),
                        i.Fangchenmis.instance.startCounter1(n, function() {
                            e.正在闯关 ?
                                (i.Fangchenmis.instance.showPopup1(
                                        (e.限制游戏小时数 > 0 ?
                                            "您累计游戏时长已经达到" + e.限制游戏小时数 + "小时" :
                                            "夜深了") + "，请尽快下线休息，做适当身体活动，合理安排学习生活！"
                                    ),
                                    i.Fangchenmis.instance.startCounter2(300, function() {
                                        e.强制引导退出();
                                    })) :
                                e.强制引导退出();
                        });
                }
            }),
            (t.prototype.强制引导退出 = function() {
                i.Fangchenmis.instance.showPopup2(
                    (this.限制游戏小时数 > 0 ? "您累计游戏时长已经达到" + this.限制游戏小时数 + "小时" : "夜深了") +
                    "，请立即下线休息，做适当身体活动，合理安排学习生活！"
                );
            }),
            (t.prototype.闯关开始 = function(t, e, o) {
                (this.正在闯关 = !0), _.default.stageStart(t, e, o);
            }),
            (t.prototype.闯关ing = function() {}),
            (t.prototype.闯关结束 = function(t) {
                _.default.stageEnd(t);
            }),
            (t.prototype.结算完毕 = function() {
                (this.正在闯关 = !1), i.Fangchenmis.instance && i.Fangchenmis.instance.counter2 && this.强制引导退出();
            }),
            (t.prototype.getStore = function(t) {
                var e = this;
                u.default.getStore ?
                    u.default.getStore(function() {
                        e.getStoreComplete({ times: 0 }, t);
                    }) :
                    u.default.local_userStorageTimes > 0 ?
                    this.getStoreComplete({ times: 0 }, t) :
                    this.getUserStore(u.default.userStorage.openId, function(o) {
                        e.getStoreComplete(o, t);
                    });
            }),
            (t.prototype.ungzipStore = function(t, e) {
                var o,
                    n = t.data;
                n
                    ?
                    (/^\s*\{/.test(n) ||
                        (n = pako.ungzip(u.default.base64Decode(n.replace(/ /g, "+")), { to: "string" })),
                        (o = JSON.parse(n))) :
                    (o = { times: 0 }),
                    e && e(o);
            }),
            (t.prototype.getUserStore = function(t, e) {
                var o = this;
                n.default.压缩存档 ?
                    n.default.使用_api ?
                    this.post_api({ op: "data/get", proj: n.default.gameName, openid: t },
                        function(t) {
                            o.ungzipStore(t, e);
                        },
                        function() {
                            e && e({ times: 0 });
                        }
                    ) :
                    this.post({ op: "getStore2", openId: t },
                        function(t) {
                            o.ungzipStore(t, e);
                        },
                        function() {
                            e && e({ times: 0 });
                        }
                    ) :
                    this.post({ op: "getStore", openId: t }, function(t) {
                        e && e(t);
                    });
            }),
            (t.prototype.getStoreComplete = function(t, e) {
                var o = this;
                this.updateStore(t);
                var n = function() {
                    (O.DatasManager.误触关 || u.default.userStorage.误触黑) && (u.default._胜利宝箱 = [0]),
                    O.DatasManager.分享关 && (o.强制显示视频 = !0);
                    var t = function() {
                        O.DatasManager.CPA关 && (o.cpbConfig = null), e && e();
                    };
                    o.cpaConfigURL1 && o.cpaConfigURL2 ? o.loadCPA12(t) : t();
                };
                if ("微信小游戏" == u.default.platformType) {
                    if (O.DatasManager.梦嘉防封策略接口) {
                        u.default.userStorage.误触黑 = !1;
                        var r = void 0;
                        u.default.userStorage.首次进入游戏的场景值 > -2 ?
                            (r = 0) :
                            ((r = 1),
                                (u.default.userStorage.首次进入游戏的场景值 = this.launchScene),
                                (u.default.userStorage.首次进入游戏的路径 = Object.keys(this.launchQuery).join(",")));
                        var a = {
                            originType: O.DatasManager.梦嘉防封策略代码编号,
                            path: Object.keys(this.launchQuery).join(","),
                            sceneId: this.launchScene,
                            isFirst: r,
                            firstPath: u.default.userStorage.首次进入游戏的路径
                        };
                        console.log("post " + O.DatasManager.梦嘉防封策略接口 + "\n" + JSON.stringify(a)),
                            wx.request({
                                url: O.DatasManager.梦嘉防封策略接口,
                                method: "POST",
                                header: { "Content-Type": "application/json" },
                                data: a,
                                success: function(t) {
                                    console.log("post " + O.DatasManager.梦嘉防封策略接口 + " 成功！"),
                                        t && 1 == t.data ?
                                        (console.log(1), (o.launchScene = 12345)) :
                                        (console.log(0), (u.default.userStorage.误触黑 = !0)),
                                        n();
                                },
                                fail: function() {
                                    console.error("post " + O.DatasManager.梦嘉防封策略接口 + " 失败！"), n();
                                }
                            });
                    } else(u.default.userStorage.误触黑 = !1), n();
                } else(u.default.userStorage.误触黑 = !1), n();
            }),
            (t.prototype.updateStore = function(t) {
                (u.default.online_userStorageTimes = t.times),
                u.default.userStorage.update(t),
                    (u.default.userStorage.A = _.default.A ? "A" : "B"),
                    u.default.userStorage.更新登录日子();
            }),
            (t.prototype.setStore = function(t, e, o) {
                u.default.userStorage.setDirty();
                var r = new Date().getTime();
                if (t || r - this.lastSetStoreTime > 6e4) {
                    this.lastSetStoreTime = r;
                    var a = u.default.userStorage.toJSONCode();
                    return (
                        n.default.压缩存档 && (a = u.default.base64Encode(pako.gzip(a, { to: "string" }))),
                        n.default.使用_api ?
                        this.post_api({
                                op: "data/set",
                                proj: n.default.gameName,
                                openid: u.default.userStorage.openId,
                                data: a
                            },
                            e,
                            o
                        ) :
                        this.post({
                                op: "setStore",
                                openId: u.default.userStorage.openId,
                                nickname: u.default.userStorage.nickname,
                                data: a
                            },
                            e,
                            o
                        ), !0
                    );
                }
                return !1;
            }),
            (t.prototype.deleteStore = function(t) {
                this.removeUserCloudStorage(),
                    u.default.userStorage.reset(),
                    n.default.使用_api ?
                    this.post_api({ op: "data/del", proj: n.default.gameName, openid: u.default.userStorage.openId },
                        t
                    ) :
                    this.post({ op: "deleteStore", openId: u.default.userStorage.openId }, t);
            }),
            (t.prototype.setRank = function(t, e) {
                this.显示世界榜 &&
                    this.post({
                            op: "setRank",
                            openId: u.default.userStorage.openId,
                            nickname: u.default.userStorage.nickname,
                            rankType: t,
                            score: e
                        },
                        null
                    );
            }),
            (t.prototype.getRanks = function(t, e) {
                this.post({ op: "getRanks", openId: u.default.userStorage.openId, limit: t }, function(t) {
                    (t.ranks && t.ranks.indexOf && t.ranks.push) || (t.ranks = new Array()),
                    t.friends &&
                        ((t.friends.vs && t.friends.vs.indexOf && t.friends.vs.push) ||
                            (t.friends.vs = new Array()),
                            (t.friends.fast1 && t.friends.fast1.indexOf && t.friends.fast1.push) ||
                            (t.friends.fast1 = new Array()),
                            (t.friends.fast2 && t.friends.fast2.indexOf && t.friends.fast2.push) ||
                            (t.friends.fast2 = new Array()),
                            (t.friends.fast3 && t.friends.fast3.indexOf && t.friends.fast3.push) ||
                            (t.friends.fast3 = new Array()),
                            (t.friends.kill && t.friends.kill.indexOf && t.friends.kill.push) ||
                            (t.friends.kill = new Array())),
                        e(t);
                });
            }),
            (t.prototype.get = function(t, e, o, r) {
                this._get(n.default.url_prefix_game, ".php", t, e, o, r);
            }),
            (t.prototype.post = function(t, e, o, r) {
                this._post(n.default.url_prefix_game, ".php", t, e, o, r);
            }),
            (t.prototype.get_api = function(t, e, o, r) {
                this._get(n.default.url_prefix_api, "", t, e, o, r);
            }),
            (t.prototype.post_api = function(t, e, o, r) {
                this._post(n.default.url_prefix_api, "", t, e, o, r);
            }),
            (t.prototype.getCache = function(t, e) {
                var o = "";
                if (e)
                    try {
                        o = localStorage.getItem(t);
                    } catch (t) {
                        console.error("e=" + t), (o = "");
                    }
                return o;
            }),
            (t.prototype.getURL = function(t, e, o) {
                if (e.op) {
                    var n = (t + e.op + o).replace(/\w+\/\.\.\//, "");
                    return delete e.op, n;
                }
                if (e.url) {
                    n = e.url;
                    return delete e.url, n;
                }
                return console.error("木有 op 或 url"), "";
            }),
            (t.prototype.requestComplete = function(t, e, o, n, r, a) {
                var i = "";
                if ("string" == typeof o) {
                    i = o;
                    try {
                        o = JSON.parse(o);
                    } catch (t) {
                        return console.error("解析失败：" + o + "\nurl=" + e), (i = ""), (o = null), void(a && a());
                    }
                }
                if (
                    (this.请求返回值套一层data ?
                        o.data ?
                        ((o = o.data), n && (i = JSON.stringify(o))) :
                        (i = "") :
                        n && (i || (i = JSON.stringify(o))),
                        n)
                )
                    try {
                        localStorage.setItem(e, i);
                    } catch (t) {
                        console.error("e=" + t);
                    }
                r && r(o);
            }),
            (t.prototype.requestError = function(t, e, o) {
                o && o();
            }),
            (t.prototype.toast = function(t) {
                if (t)
                    if (t.includes("\n"));
                    else {
                        var e = t.match(/^([^\uff0c\uff1b]{6,}[\uff0c\uff1b])(.+)$/);
                        e && (t = e[1] + "\n" + e[2]);
                    }
                return t;
            }),
            (t.prototype.checkUpdate = function() {}),
            (t.prototype.显示一键添加到我的小程序 = function() {}),
            (t.prototype.getAssetPath = function(t, e, o) {
                var n = cc.assetManager.getBundle(t);
                n.load(e, function(r, a) {
                    r
                        ?
                        console.error("getAssetPath " + t + " " + e + " " + r) :
                        (console.log("getAssetPath " + t + " " + e + " " + a.nativeUrl),
                            o(a.nativeUrl),
                            n.release(e));
                });
            }),
            (t.prototype.加载完毕 = function() {
                var t = this;
                if (this.检查是否过滤显示广告())
                    if ((this.加载完毕初始化广告(), this.rewardAdCtrl));
                    else {
                        var e = n.default.假广告用来苹果过审();
                        if (e) {
                            var o = u.default.prefabs.instantiate("假广告用来苹果过审").getComponent(d.default);
                            o.init(e),
                                (o.onClose = function(e) {
                                    t.rewardAdCtrl.close(e);
                                }),
                                (this.rewardAdCtrl = new h.default(
                                    "激励视频", {
                                        show: function() {
                                            u.default.container.setSiblingIndex(
                                                    u.default.container.parent.childrenCount
                                                ),
                                                u.default.container.addChild(o.node),
                                                o.show();
                                        }
                                    },
                                    "不需要广告ID"
                                ));
                        }
                    }
            }),
            (t.prototype.检查是否过滤显示广告 = function() {
                if (O.DatasManager.开始限制显示广告的时间) {
                    var t = O.DatasManager.开始限制显示广告的时间.match(
                        /(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)/
                    );
                    if (t) {
                        var e = new Date(
                            parseInt(t[1]),
                            parseInt(t[2]) - 1,
                            parseInt(t[3]),
                            parseInt(t[4]),
                            parseInt(t[5]),
                            parseInt(t[6])
                        );
                        if (
                            new Date() > e &&
                            (console.log("开始限制显示广告的时间", e),
                                O.DatasManager.显示广告的openIds && O.DatasManager.显示广告的openIds.length)
                        ) {
                            if (-1 == O.DatasManager.显示广告的openIds.indexOf(u.default.userStorage.openId)) return !1;
                            console.log("显示广告的openId", u.default.userStorage.openId);
                        }
                    }
                }
                return !0;
            }),
            (t.prototype.初始化时初始化广告 = function() {}),
            (t.prototype.初始化完毕初始化广告 = function() {}),
            (t.prototype.加载完毕初始化广告 = function() {}),
            (t.prototype.进入游戏 = function() {
                (this.已进入游戏 = !0), this.checkLaunchOptions();
            }),
            (t.prototype.removeUserCloudStorage = function() {}),
            t
        );
    })();
o.default = P;